#!/bin/sh

case $1 in
  a)
    git add `echo "$@" | cut -w -f 2-1000`
    exit 0
    ;;
  s)
    git status
    exit 0
    ;;
  p)
    git pull
    exit 0
    ;;
  P)
    git push
    exit 0
    ;;
  c)
    git commit $2
    exit 0
    ;;
  C)
    git checkout $2
    exit 0
    ;;
  M)
    git merge $2
    exit 0
    ;;
  b)
    git branch $2
    exit 0
    ;;
  d)
    git diff
    exit 0
    ;;
  r)
    git restore $2
    exit 0
    ;;
  q)
    break
    ;;
  *)
   git status
    ;;
esac


while :
do
  echo "?"
  read cmd
  case $cmd in
    s)
      git status
      ;;
    p)
      git pull
      ;;
    P)
      git push
      ;;
    c)
      git commit
      ;;
    q)
      break
      ;;
    *)
      echo "Unknown command."
      ;;
  esac
done